package ru.urfc.portal.ui.client.googlets.client;

import ru.urfc.portal.ui.client.BaseGooglet;
import ru.urfc.portal.ui.client.Style;
import ru.urfc.portal.ui.client.controllers.ItemsController;
import ru.urfc.portal.ui.client.descriptor.GridDescriptor;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.event.shared.GwtEvent.Type;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Widget;

public class UserEdit extends BaseGooglet {

	interface Binder extends UiBinder<Widget, UserEdit> {}
	private static Binder binder = GWT.create(Binder.class);
	
	@UiField Style style;
//	@UiField TextField<String> firstName;
//	@UiField TextField<String> middleName;
//	@UiField TextField<String> lastName;
	@UiField Element email;
//	@UiField TextField<String> phone;

	public Type<ItemsController> SAVE = new Type<ItemsController>();

//	@UiHandler("save")
//	void save(ClickEvent e) {
//		getEventsDispatcher().fireEvent(new PutEvent(SAVE));
//	}

	@Override
	protected void init() {
		initWidget(binder.createAndBindUi(this));
		
		GridDescriptor descriptor = new GridDescriptor(USER, USERS, getUserId());
//		descriptor.addTextField("firstName", firstName);
//		descriptor.addTextField("middleName", middleName);
//		descriptor.addTextField("lastName", lastName);
		descriptor.addTextField("email", email);
//		descriptor.addTextField("phone", phone);
		
		register(SAVE, (ItemsController)createController(descriptor)); 
	}

}